package practice1_100;

public class Practice74 {
    public boolean searchMatrix(int[][] matrix, int target) {
       int len= matrix.length* matrix[0].length;
       return binSeach(matrix,target,0,len-1);
    }
    public boolean binSeach(int[][] matrix, int target,int begin,int end){
        if(begin>end) return false;
        int mid=(begin+end)/2;
        int row=mid/matrix[0].length;
        int column=mid%matrix[0].length;
        if(matrix[row][column]==target) return true;
        return binSeach(matrix,target,begin,mid-1)||binSeach(matrix,target,mid+1,end);

    }

    public static void main(String[] args) {
        boolean a= new Practice74().searchMatrix(new int[][]{{1,3,5,7},{10,11,16,20},{23,30,34,60}},13);
        System.out.println(a);
    }
}
